home *** CD-ROM | disk | FTP | other *** search
- #include <CMMDlib.h>
- #include <stdio.h>
- #include <errno.h>
-
- #ifndef ANY_TAG
- #define ANY_TAG -1
- #endif
-
- #include <comm.h>
- extern int errno;
-
- /* This is template program for the host */
- void
- TIO_init_procedure()
-
- {
- void Main_Function ();
- int iteractions;
- char buf[20];
- #if 0
- if (argc < 2)
- {fprintf (stderr, "Usage: %s\n", argv[0]);
- exit (-1);
- }
- #endif
- sleep(4);
- printf("Number of iterations: ");
- if (gets(buf) <= (char *)0) {
- if (errno == EINTR)
- gets(buf);
- }
- iteractions = atoi (buf);
-
- #ifdef CM5
- CMMD_enable (); /* Initializa CMMD */
- Ocean_Main (); /* Start all nodes */
- #endif
-
- CMMD_bc_from_host ((char *) (& iteractions), sizeof (int));
- }
-
-
-
- finish()
- {
- double time_1, time_2;
-
- CMMD_receive (0, ANY_TAG, &time_1, sizeof (double));
- CMMD_receive (0, ANY_TAG, &time_2, sizeof (double));
- printf ("time_1 = %12.3f, time_2 = %12.3f, time = %12.3f\n", time_1,
- time_2, time_2-time_1);
-
- #ifdef CM5
- CMMD_sync_host_with_nodes (); /* Wait for nodes to finish */
- CMMD_disable (); /* Disable CMMD library */
- #endif
-
- }
-
-